'use strict';

var Router = require('koa-router');
var ctrl = require('./wechat.controller');

var wechatRouter = function wechatRouter(app) {
  var router = new Router({
    prefix: '/v1/wechat'
  });

  app
    .use(router.routes())
    .use(router.allowedMethods());

  router.get('/', ctrl.checkSignature)
    .post('/', ctrl.reply)
    .get('/oauth', ctrl.getOauth)
    .get('/oauthback', ctrl.getOauthBack)
    ;

};

module.exports = wechatRouter;
